package net.zkbc.helloworld.service.impl;

import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import net.zkbc.helloworld.entity.User;
import net.zkbc.helloworld.service.UserService;

@Component
public class UserServiceImpl implements UserService {

	@Override
	public User findUserByLoginName(String loginName) {
		if (StringUtils.isEmpty(loginName)) {
			return null;
		}

		return findByLoginName(loginName);
	}

	private User findByLoginName(String loginName) {
		User user = new User();
		user.setLoginName("zkbc");

		if (!loginName.equals(user.getLoginName())) {
			return null;
		}

		return user;
	}

}
